package event 
{
	import connect.Jsfl;
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import flash.events.TimerEvent;
	import flash.utils.Timer;
	/**
	 * ...
	 * @author chitose
	 */
	public class DocumentEvent extends EventDispatcher
	{
		public static const CHANGE:String = "change";
		
		private var timer:Timer
		private var currentURI:String;
		
		public function DocumentEvent() {
			timer = new Timer(1000);
			timer.addEventListener(TimerEvent.TIMER, interval)
			timer.start();
		}
		
		private function interval(e:TimerEvent):void {
			if (Jsfl.getDocument()>0) {
				var str:String=Jsfl.getPathURI()
				if (currentURI != str) {
					dispatchEvent(new Event(CHANGE));
				}
				currentURI = str;
			}
		}
	}

}